const path = require("path");
const express = require("express");
const proxyMiddleware = require("http-proxy-middleware");
const history = require("connect-history-api-fallback");
const app = express();
app.use(
  history({
    // 查看记录
    // verbose: true
  })
);
require("./API/config.js");
app.use(express.static(path.join(__dirname, "/dist/")));
const proxyTable = require('./config/proxy-table')

Object.keys(proxyTable).forEach(function (context) {
  const options = proxyTable[context];
  if (typeof options === "string") {
    options = {
      target: options
    };
  }
  app.use(proxyMiddleware(context, options));
});
app.listen(8019, function (err) {
  if (err) {
    return;
  }
});
// 开发   8019
// 测试   8029
// 预生产 8039
// 生产   8049